package com.system.controller;


import com.system.po.info.Personnel;
import com.system.service.DirectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(description = "指挥部")
@RequestMapping("dir")
@Controller
@ResponseBody
public class DirectController {

    @Autowired
    private DirectService  directService;


    @ApiOperation(value = "查询总指挥")
    @GetMapping("/queryCommandere")
    public List<Personnel> queryCommandere(){
        List<Personnel> queryCommandere = directService.queryCommandere();
        return queryCommandere;
    }
    @ApiOperation(value = "查询副总指挥")
    @GetMapping("/queryViceCommandere")
    public List<Personnel> queryViceCommandere(){
        List<Personnel> queryViceCommandere = directService.queryViceCommandere();
        return queryViceCommandere;
    }
    @ApiOperation(value = "查询安全副矿长")
    @GetMapping("/queryDeputySafetyDirecto")
    public List<Personnel> queryDeputySafetyDirecto(){
        List<Personnel> queryDeputySafetyDirecto = directService.queryDeputySafetyDirecto();
        return queryDeputySafetyDirecto;
    }
    @ApiOperation(value = "查询救援大队")
    @GetMapping("/queryRescueBrigade")
    public List<Personnel> queryRescueBrigade(){
        List<Personnel> queryRescueBrigade = directService.queryRescueBrigade();
        return queryRescueBrigade;
    }

    @ApiOperation(value = "查询单条数据")
    @GetMapping("/Singlearticle/{id}")
    public Personnel Singlearticle(@PathVariable("id") Integer id){
        Personnel queryDeputySafetyDirecto = directService.Singlearticle(id);
        return queryDeputySafetyDirecto;
    }

    @ApiOperation(value = "增加总指挥")
    @PostMapping("/addCommandere")
    public Boolean addCommandere(@RequestBody Personnel Personnel){
        Boolean addCommandere = directService.addCommandere(Personnel);
        return addCommandere;
    }

    @ApiOperation(value = "增加副总指挥")
    @PostMapping("/addViceCommandere")
    public Boolean addViceCommandere(@RequestBody Personnel Personnel){
        Boolean addViceCommandere = directService.addViceCommandere(Personnel);
        return addViceCommandere;
    }


    @ApiOperation(value = "增加安全副矿长")
    @PostMapping("/addDeputySafetyDirecto")
    public Boolean addDeputySafetyDirecto(@RequestBody Personnel Personnel){
        Boolean addDeputySafetyDirecto = directService.addDeputySafetyDirecto(Personnel);
        return addDeputySafetyDirecto;
    }

    @ApiOperation(value = "增加救援大队")
    @PostMapping("/addRescueBrigade")
    public Boolean addRescueBrigade(@RequestBody Personnel Personnel){
        Boolean addRescueBrigade = directService.addRescueBrigade(Personnel);
        return addRescueBrigade;
    }



    @ApiOperation(value = "编辑副总指挥")
    @PutMapping("/editRescueBrigade")
    public Boolean editwholeCommandere(@RequestBody Personnel personnel){
        Boolean editwholeCommandere=directService.editwholeCommandere(personnel);
        return editwholeCommandere;
    }

    @ApiOperation(value = "删除角色")
    @DeleteMapping ("/deleteCommandere")
    public Boolean deletewholeCommandere(@RequestBody Personnel personnel){
        Boolean deletewholeCommandere=directService.deletewholeCommandere(personnel);
        return deletewholeCommandere;
    }


}
